package nimble.unionpay.openapi;

import org.apache.commons.lang3.StringUtils;

public enum CardCatalog {

    BANK_CARD("1","银行卡"),
    TRADE_CARD("2","行业卡"),
    UNKNOWN("0","未知");

    private String code;
    private String desc;

    public String getCode()
    {
        return code;
    }

    public String getDesc()
    {
        return desc;
    }

    CardCatalog(String code, String desc)
    {
        this.code=code;
        this.desc=desc;
    }

    public static CardCatalog parse(String code)
    {
        for(CardCatalog cardCatalog:CardCatalog.values())
        {
            if(StringUtils.equalsAny(code,cardCatalog.name(),cardCatalog.getCode()))
            {
                return cardCatalog;
            }
        }
        return null;
    }
}
